﻿<Window xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"  
        xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
        x:Class="Pathfinder.UI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Pathfinder .Net"
        xmlns:ViewModels="clr-namespace:Pathfinder.UI.ViewModels"
        xmlns:s="clr-namespace:System;assembly=mscorlib"
        Width="1024" Height="768" Loaded="Window_Loaded" 
        Icon="Resources/PathfinderIcon.png"
        xmlns:fluent="clr-namespace:Fluent;assembly=Fluent">
    <Window.Resources>
        
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

        <!-- Timer Template-->
        <DataTemplate DataType="{x:Type ViewModels:TimerViewModel}">
            <StackPanel Margin="10">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

                    <Button Command="{Binding PlayCommand}" ToolTip="Play" Width="32" Height="32" Margin="2"
                            Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <Image Source="Resources\MediaPlayLarge.png"/>
                    </Button>
                    
                    <Button Command="{Binding PauseCommand}" ToolTip="Pause" Width="32" Height="32" Margin="2"
                            Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <Image Source="Resources\MediaPauseLarge.png"/>
                    </Button>

                    <Button Command="{Binding NextCommand}" ToolTip="Next Frame" Width="32" Height="32" Margin="2">
                        <Image Source="Resources\MediaNextLarge.png"/>
                    </Button>
                    
                </StackPanel>
                
                <Label Content="Ticks Per Frame" HorizontalAlignment="Center"/>
                <xctk:IntegerUpDown Value="{Binding TicksPerFrame}" Width="100" Minimum="1"/>
            
            </StackPanel>
        </DataTemplate>
        
    </Window.Resources>
    
    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <fluent:Ribbon DataContext="{Binding ToolBarHost}">
            <fluent:RibbonTabItem Header="Home">
                
                <fluent:RibbonGroupBox Header="File">
                    <fluent:Button LargeIcon="/Pathfinder.UI;component/Resources/NewMapLarge.png" Header="New Map" Command="{Binding NewMapCommand}"/>
                    <fluent:Button LargeIcon="/Pathfinder.UI;component/Resources/SaveMapLarge.png" Header="Save" Command="{Binding SaveMapCommand}"/>
                    <fluent:Button LargeIcon="/Pathfinder.UI;component/Resources/LoadMapLarge.png" Header="Load" Command="{Binding LoadMapCommand}"/>
                </fluent:RibbonGroupBox>

                <!--<fluent:RibbonGroupBox Header="Movement">
                    <fluent:Button LargeIcon="/Pathfinder.UI;component/Resources/FourWayMovementLarge.png" Header="Four Way" ToolTip="4 Direction Movement" />
                    <fluent:Button LargeIcon="/Pathfinder.UI;component/Resources/EightWayMovementLarge.png" Header="Eight Way" ToolTip="8 Direction Movement" />
                </fluent:RibbonGroupBox>

                <fluent:RibbonGroupBox Header="Cost Calculation">
                    <fluent:Button LargeIcon="/Pathfinder.UI;component/Resources/EightWayMovementWithoutBlockLarge.png" Header="Non Blocking" ToolTip="Do not block diagonal movement." />
                    <fluent:Button LargeIcon="/Pathfinder.UI;component/Resources/EightWayMovementWithBlockLarge.png" Header="Blocking" ToolTip="Block diagonal movement around blocked nodes."  />

                    <fluent:Spinner Header="Edges:      " Width="125" Margin="2"/>
                    <fluent:Spinner Header="Diagonals:" Width="125" Margin="2"/>
                </fluent:RibbonGroupBox>

                <fluent:RibbonGroupBox Header="Heuristic">
                    <fluent:Button LargeIcon="/Pathfinder.UI;component/Resources/Buttons/ZeroHeuristicButton.png" Header="Zero" ToolTip="Zero Heuristic." />
                    <fluent:Button LargeIcon="/Pathfinder.UI;component/Resources/Buttons/DirectionalHeuristicButton.png" Header="Directional" ToolTip="From / To Heuristic."  />

                    <fluent:Spinner Header="Multiplier:" Width="125" Margin="2"/>
                </fluent:RibbonGroupBox>-->

            </fluent:RibbonTabItem>
        </fluent:Ribbon>
        
        <xcad:DockingManager Grid.Row="1"
                           AllowMixedOrientation="True"
                           BorderBrush="Black"
                           BorderThickness="1">

            <xcad:DockingManager.Theme>
                <xcad:AeroTheme/>
            </xcad:DockingManager.Theme>

            <xcad:DockingManager.DocumentHeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{Binding IconSource}" Margin="0,0,4,0"/>
                        <TextBlock Text="{Binding Title}" />
                    </StackPanel>
                </DataTemplate>
            </xcad:DockingManager.DocumentHeaderTemplate>

            <xcad:DockingManager.DocumentTitleTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{Binding IconSource}" Margin="0,0,4,0"/>
                        <TextBlock Text="{Binding Title}" TextTrimming="CharacterEllipsis"/>
                    </StackPanel>
                </DataTemplate>
            </xcad:DockingManager.DocumentTitleTemplate>
           
            <xcad:LayoutRoot x:Name="_layoutRoot">
                
                <xcad:LayoutPanel Orientation="Horizontal">

                    <!-- Timer and Controls Panel-->
                    <xcad:LayoutAnchorablePaneGroup DockMinWidth="200" Orientation="Vertical">

                        <!-- Timer Panel -->
                        <xcad:LayoutAnchorablePane DockMinWidth="200" DockWidth="240">
                            <xcad:LayoutAnchorable ContentId="timer" Title="Frame Timer" IconSource="Resources/TimerTabIcon.png" CanHide="False" CanClose="False" AutoHideWidth="240" FloatingWidth="240" FloatingLeft="100" FloatingTop="100">
                                <ContentControl Height="125">
                                    <ContentControl.Content>
                                        <ViewModels:TimerViewModel/>
                                    </ContentControl.Content>
                                </ContentControl>
                            </xcad:LayoutAnchorable>
                        </xcad:LayoutAnchorablePane>

                        <!-- Controls Panel-->
                        <xcad:LayoutAnchorablePane DockMinWidth="200" DockWidth="240" DockMinHeight="400">
                            <xcad:LayoutAnchorable ContentId="controls" Title="Controls" IconSource="Resources/ControlsTabIcon.png" CanHide="False" CanClose="False" AutoHideWidth="240">
                                <ContentControl>
                                    <ContentControl.Content>
                                        <ContentControl x:Name="ControlHost"/>
                                    </ContentControl.Content>
                                </ContentControl>
                            </xcad:LayoutAnchorable>
                        </xcad:LayoutAnchorablePane>

                    </xcad:LayoutAnchorablePaneGroup>

                    <!-- Main Content -->
                    <xcad:LayoutDocumentPane>
                        <xcad:LayoutDocument ContentId="map" Title="Map" IconSource="Resources/MapTabIcon.png" CanClose="False" CanFloat="False">
                            <ContentControl x:Name="MapHost"/>
                        </xcad:LayoutDocument>
                    </xcad:LayoutDocumentPane>

                    <!-- Work queue Panel-->
                    <xcad:LayoutAnchorablePaneGroup DockMinWidth="200" Orientation="Vertical">

                        <xcad:LayoutAnchorablePane DockMinWidth="240" DockWidth="240">
                            <xcad:LayoutAnchorable ContentId="workqueue" Title="Work Queue" IconSource="Resources/WorkQueueTabIcon.png" CanHide="False" CanClose="False" AutoHideWidth="240" FloatingWidth="240" FloatingLeft="100" FloatingTop="100">
                                <ContentControl>
                                    <ContentControl.Content>
                                        <ContentControl x:Name="WorkQueueHost"/>
                                    </ContentControl.Content>
                                </ContentControl>
                            </xcad:LayoutAnchorable>
                        </xcad:LayoutAnchorablePane>

                    </xcad:LayoutAnchorablePaneGroup>

                </xcad:LayoutPanel>
                
            </xcad:LayoutRoot>
            
        </xcad:DockingManager>
        
    </Grid>
</Window>
